<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>最佳女王瑜伽培训</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
 <style>
    body, p, input, h1, h2, h3, h4, h5, h6, ul, li, dl, dt, dd, form { margin: 0; padding: 0; list-style: none; vertical-align: middle; font-weight:normal; }   
    .slideBox{ position:relative;}
    .slideBox .hd{position:fixed; width:100%;height:28px; line-height:28px; bottom:10px; right:0; z-index:1; text-align: center;}
    .slideBox .hd li{ display:inline-block; width:5px; height:5px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; background:#944; text-indent:-9999px; overflow:hidden; margin:0 3px;   }
    .slideBox .hd li.on{ background:#f00; width:5px;height: 5px; }

    .slideBox .bd{ position:relative; z-index:0; }
    .slideBox .bd li{ position:relative;  display:inline-block;  }
    .slideBox .bd li img{ width:100%;background: url(images/load.gif);
      background-repeat: no-repeat;
      background-position:center;  border:0px;
      border:0px solid #eee;
    }
    .slideBox .bd li a{ -webkit-tap-highlight-color:rgba(0, 0, 0, 0); /* 取消链接高亮 */ }
    .slideBox .bd li .tit{ display:block; width:100%;  position:absolute; top:0; text-indent:10px; height:28px; line-height:28px;  color:#fff;   }
    body{background-color: #fff;}
   .box{}


   .is-loading{
      background-color: #fff;
      background-image: url('../images/load.gif');
      background-repeat: no-repeat;
      background-position:center;
    }

@keyframes spin {
    0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
    .page-loading {
    width: 100%;
    height: 100%;
    background-color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    overflow: hidden;
}

.loader {
    border: 3px solid #ddd;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    border-top: 3px solid #000;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    top: 50%;
    left: 50%;
    position: absolute;
    margin: -25px 0 0 -25px;
}
    </style>    
</head>
<body>   

<div class="page-loading">
    <div class="loader"></div>
</div>
<div class="box">
   
   <div id="slideBox" class="slideBox">

                <div class="bd">
                    <ul id="ulhtml">
                        
                    </ul>
                </div>

                <div class="hd">
                    <ul></ul>
                </div>
            </div> 

</div>
  
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script src="/js/lib/mobile/TouchSlide.1.1.js"></script>
<script type="text/javascript">
   $('.page-loading').show();
   function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
    

    function product_loadItem(){

    var screeWidth=$(window).width();
    var screenHeight=$(window).height();
    var boxHeight=300; 
    var tempLate="<li><div class='is-loading'><img _src='../files/upload/small/{{newImg}}' src='images/bg.png' style='heigth:{{height}};' /></div></li>";    
    var Jsondata = {};
    Jsondata.id = GetQueryString("id");
    $.post("/admin/getproduct",Jsondata,function (response) { 
	  var Resulthtml=""
	  alert(response.images);
		 for(i=0;i<response.images.length;i++){
			var o=response.images[i];
			var tempLi=tempLate;

			var h=(400.00/o.width*o.height);
			var imgHeight=screeWidth/400*h; 

			Resulthtml+=tempLi.replace("{{newImg}}",o.filename).replace("{{title}}",o.description).replace("{{height}}",imgHeight+"px");

			boxHeight=boxHeight<imgHeight?imgHeight:boxHeight;
		 }
		 $("#ulhtml").html(Resulthtml);

		 TouchSlide({ 
					slideCell:"#slideBox",
					titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
					mainCell:".bd ul", 
					//effect:"leftLoop", 
					autoPage:true //自动分页
					,autoPlay:false
					,switchLoad:"_src"
		});       

		var marginTop= (screenHeight-boxHeight)/2.0;    
		
		if(marginTop>0)$(".box").css("margin-top",marginTop+"px");
		$("li").css("vertical-align","middle");

		if(response.images.length>1)$(".hd").show();
		else $(".hd").hide()

		 $('.page-loading').delay(0).fadeOut(1000);		 
	 },"json");
}



$(function(){
    product_loadItem();
});
</script>
  
</body>
</html>
